package com.sww.pj.sys.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.sww.pj.common.pojo.JsonResult;
import com.sww.pj.common.pojo.PageObject;
import com.sww.pj.sys.pojo.SwwWz;
import com.sww.pj.sys.service.SwwWzService;

@Controller
@ResponseBody
@RequestMapping("/sww/")
public class SwwWzController {
	
	@Autowired
	private SwwWzService swwWzService;

	@RequestMapping("doUpdateObject")
	public String doUpdateObject(SwwWz entity){
		swwWzService.updateObjects(entity);
		return "修改成功";
	}
	@RequestMapping("doFindObjectById")
	public SwwWz doFindObjectById(Integer wzid) {
		SwwWz swwWz = swwWzService.findObjectById(wzid);
		return swwWz;
	}

	@RequestMapping("doSaveObjects")
	@ResponseBody
	public JsonResult doSaveObjects(SwwWz entity) {
		swwWzService.saveObject(entity);
		return new JsonResult("恭喜你，保存成功");
		
	}
	@RequestMapping("doDeleteObjects")
	@ResponseBody
	public JsonResult doDeleteObjects(Integer... ids) {
		swwWzService.deleteObjects(ids);
		return new JsonResult("删除成功");
		
	}
	
	@RequestMapping("doFindPageObjects")
	@ResponseBody
	public JsonResult doFindPageObjects(String wzname,Long pageCurrent){
	 PageObject<SwwWz> pageObject=
		swwWzService.findPageObjects(wzname,pageCurrent);
	return new JsonResult(pageObject);
	}


}
